package user;

import operation.*;
import student.StudentList;

import java.util.Scanner;

public class User {
    private IOperation[] iOperations;
    public User(){
        iOperations = new IOperation[]{
                new ExitOperation(),
                new AddOperation(),
                new DelOperation(),
                new ModifOperation(),
                new FindIndexOperation(),
                new FindAllOperation()
        };
    }
    public int menu(){
        System.out.println("=============");
        System.out.println("0. 退出系统");
        System.out.println("1. 增加信息");
        System.out.println("2. 删除信息");
        System.out.println("3. 修改消息");
        System.out.println("4. 单个查找");
        System.out.println("5. 全部查找");
        System.out.println("=============");
        Scanner sc = new Scanner(System.in);
        return sc.nextInt();
    }
    public void doOperation(int choice, StudentList list){
        iOperations[choice].work(list);
    }
}
